import flash.events.Event;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.geom.Matrix;
import flash.text.TextField;
import flash.text.TextFormat;

import Images;
class CreditsPageEvent extends Event{
 
	public function new(customEventString:String){

	super(customEventString, true, false);

    }
}

class CreditsPage extends Sprite
{
private var BackButton:Sprite;
private var CurrentBackground: Sprite;
private var Text:TextField;

  public function new()
  {
  super();
  //Resize Image
  CurrentBackground = new Sprite();//, PixelSnapping.NEVER, true);
  CurrentBackground.graphics.beginFill(0xFFFFFF);
  CurrentBackground.graphics.lineStyle(1,0x000000);
  CurrentBackground.graphics.drawRect(0, 0, Constants.flashWidth,Constants.flashHeight); 
  //End Resize
  addChild(CurrentBackground);

  Text = new TextField();
    
  Text.x = 50; Text.y = 40;
  Text.width = 540; Text.height = 420;
  addChild(Text);
  Text.multiline = true;
  var myFormat:TextFormat = new TextFormat();
  myFormat.size = 15;
  //myFormat.align = TextFormatAlign.CENTER;
  Text.defaultTextFormat = myFormat;
  
  Text.htmlText = "Music is 'Deliberate Thought' by Kevin MacLeod (incompetech.com)\nLicensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/\n\n"+
"Achievement Sound Effect by NoiseCollector\n(http://www.freesound.org/people/NoiseCollector/sounds/5257/)\nLicensed under Creative Commons Sampling Plus 1.0.\n
 Everything Else by ZeroCreativity1";

  BackButton  = new Sprite();
  BackButton.graphics.beginBitmapFill(new BackImage());
  BackButton.graphics.drawRect(0, 0, 25 ,25);
  BackButton.x = 515;
  BackButton.y = 25;
  BackButton.buttonMode = true;
  BackButton.addEventListener(MouseEvent.CLICK, onBackButtonClick);
  addChild(BackButton);
  }

private function onBackButtonClick(event:MouseEvent) {
    Back();
}

  public function Back()
  {
  dispatchEvent(new CreditsPageEvent("Back"));
  }
}